<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @fileOverview 뷰어의 AjaxHistory(브라우저의 뒤로가기 대체 기능) 컨트롤러
<span class='line'>  3</span>  * @author oz_moon
<span class='line'>  4</span>  */</span><span class="WHIT">
<span class='line'>  5</span> </span><span class="NAME">nhn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.nhn</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  6</span> </span><span class="NAME">nhn.newsstand</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  7</span> </span><span class="NAME">nhn.newsstand.viewer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand.viewer</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  8</span> </span><span class="NAME">nhn.newsstand.viewer.history</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand.viewer.history</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  9</span> </span><span class="NAME">nhn.newsstand.viewer.history.Controller</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Class</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 10</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 11</span> </span><span class="WHIT">	</span><span class="COMM">/** @lends nhn.newsstand.viewer.history.Controller.prototype */</span><span class="WHIT">
<span class='line'> 12</span> </span><span class="WHIT">	</span><span class="NAME">_oAjaxHistoryInstance</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 13</span> </span><span class="WHIT">	</span><span class="NAME">_htInitOption</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 15</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 16</span> 	 * nhn.newsstand.viewer.history.Controller 클래스의 인스턴스를 생성한다.
<span class='line'> 17</span> 	 * @constructs
<span class='line'> 18</span> 	 * @class 뷰어 > 지면뷰어에서 AjaxCall이 발생하면 요청/응답데이터를 내부에 저장하고 화면을 구성하는 컨트롤러(뒤로가기 기능을 담당하기도 함)
<span class='line'> 19</span> 	 * @extends nhn.newsstand.common.AbstractController
<span class='line'> 20</span> 	 * @requires jindo.AjaxHistory
<span class='line'> 21</span> 	 * @requires nhn.newsstand.common.util
<span class='line'> 22</span> 	 * @example
<span class='line'> 23</span> 	 * var oHistoryController = new nhn.newsstand.viewer.history.Controller();
<span class='line'> 24</span> 	 */</span><span class="WHIT">
<span class='line'> 25</span> </span><span class="WHIT">	</span><span class="NAME">$init</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oOptions</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">		</span><span class="NAME">this._bLoad</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">		</span><span class="NAME">this._htInitOption</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oUtil.cloneHashTable</span><span class="PUNC">(</span><span class="NAME">oOptions</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="WHIT">		</span><span class="NAME">this._initAjaxHistoryComponent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 31</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 32</span> 	 * Jindo.AjaxHistory Component 초기화
<span class='line'> 33</span> 	 */</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">	</span><span class="NAME">_initAjaxHistoryComponent</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">		</span><span class="NAME">this._oAjaxHistoryInstance</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">jindo.AjaxHistory</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">			</span><span class="NAME">sIFrameUrl</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"/js/libs/history.html"</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attach</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 39</span> </span><span class="WHIT">			</span><span class="STRN">"change"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oCustomEvent</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 40</span> </span><span class="WHIT">				</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">htHistoryData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oCustomEvent.htHistoryData</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 41</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 42</span> </span><span class="WHIT">				</span><span class="COMM">//뒤로 가기 이동 후 #값이 없는 URL일경우 초기 페이지로 인식 하도록 로딩플래그 초기화</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT">				</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oUtil.isEqualObject</span><span class="PUNC">(</span><span class="NAME">htHistoryData</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="WHIT">					</span><span class="NAME">htHistoryData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self._htInitOption</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 45</span> </span><span class="WHIT">					</span><span class="NAME">self._bLoad</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 46</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'> 48</span> </span><span class="WHIT">				</span><span class="NAME">self.sendMessage</span><span class="PUNC">(</span><span class="STRN">"requestPaperData"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">					</span><span class="STRN">"sPublDate"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">htHistoryData.sPublDate</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">					</span><span class="STRN">"sPressCd"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">htHistoryData.sPressCd</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">					</span><span class="STRN">"nCurPage"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">htHistoryData.nCurPage</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">					</span><span class="STRN">"nViewPageCnt"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">htHistoryData.nViewPageCnt</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">					</span><span class="STRN">"sArticleId"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">			</span><span class="STRN">"load"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oCustomEvent</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">				</span><span class="COMM">//초기 뷰어 진입시 기사 아이디가 있다면 기사 뷰어 띄우기</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">				</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">self._htInitOption.sArticleId</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">					</span><span class="NAME">self.sendMessage</span><span class="PUNC">(</span><span class="STRN">"showArticleViewer"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">self._htInitOption.sArticleId</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">					</span><span class="NAME">self.sendMessage</span><span class="PUNC">(</span><span class="STRN">"setGlobalOption"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="STRN">"sArticleId"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="WHIT">			</span><span class="WHIT">
<span class='line'> 62</span> 
<span class='line'> 63</span> </span><span class="WHIT">				</span><span class="NAME">self.sendMessage</span><span class="PUNC">(</span><span class="STRN">"requestPaperData"</span><span class="PUNC">,</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 66</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 69</span> 	 * AjaxHistory 인스턴스를 초기화한다.
<span class='line'> 70</span> 	 */</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">	</span><span class="NAME">_initalize</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oOptions</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">		</span><span class="NAME">this._oAjaxHistoryInstance.initialize</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 76</span> 	 * 히스토리 추가 메세지에 대한 핸들러
<span class='line'> 77</span> 	 * @param {HashTable} htParam AjaxHistory에 저장할 파라미터
<span class='line'> 78</span> 	 */</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">	</span><span class="NAME">MSG_addHistory</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htParam</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this._bLoad</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">this._oAjaxHistoryInstance.addHistory</span><span class="PUNC">(</span><span class="NAME">htParam</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">		</span><span class="NAME">this._bLoad</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">extend</span><span class="PUNC">(</span><span class="NAME">nhn.newsstand.common.AbstractController</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>